4D Chart v13

CT Array to polygon

Home

 
4D Chart v13
CT Array to polygon

CT Array to polygon 


 

CT Array to polygon ( area ; arrayH ; arrayV ) -> Function result 
Parameter Type   Description
area  Longint in 4D Chart area
arrayH  Real array in Array of horizontal values for vertices
arrayV  Real array in Array of vertical values for vertices
Function result  Longint in The new object's Object ID

CT Array to polygon creates a new polygon in area based on the arrays arrayH and arrayV and returns the new object’s ID.

arrayH and arrayV describe the position of each vertex of the polygon. The two arrays can be of type Real, Long Integer, or Integer, and are specified in points. Each array must have at least three elements for the polygon to be successfully created. If the arrays are not the same size, the extra elements in the larger array are ignored. To create a closed polygon, the last value in each array must match the first value.

Example  

This example fills two arrays and creates a polygon from them. It then moves and resizes the polygon:

 $Vertices:=Num(Request("Enter number of vertices:"))
 If(OK=1) `Declare the arrays
    ARRAY REAL(aVerticeH;$Vertices)
    ARRAY REAL(aVerticeV;$Vertices)
    For($i;1;$Vertices`Fill the arrays
       aVerticeH{$i}:=Sin($i)
       aVerticeV{$i}:=Cos($i)
    End for
  `Draw the polygon
    $Poly:=CT Array to polygon(Area;aVerticeH;aVerticeV)
  `Move the polygon to the area cordinates (10,10)
    CT MOVE(Area;$Poly;10;10)
    CT SIZE(Area;$Poly;200;200) `Resize the polygon to 200x200
 End if

 
PROPERTIES 

Product: 4D Chart
Theme: CT Objects
Number: 14561

 
INDEX

Alphabetical list of commands

 
HISTORY 

Created: 4D Chart 1